home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / visual / perl.exe / {app} / Library / Perl / perltidy.txt < prev    next >
Encoding:
Text File  |  2003-01-08  |  32.8 KB  |  749 lines

  1. NAME
  2.     perltidy - a Perl script indenter and reformatter
  3.  
  4. SYNOPSIS
  5.         perltidy [ options ] file1 file2 file3 ...
  6.                 (output goes to file1.tdy, file2.tdy, file3.tdy, ...)
  7.         perltidy [ options ] file1 -o outfile
  8.         perltidy [ options ] file1 -st >outfile
  9.         perltidy [ options ] <infile >outfile
  10.  
  11. DESCRIPTION
  12.     Perltidy reads a Perl script and writes an indented, reformatted script.
  13.     The default formatting closely follows the recommendations in
  14.     perlstyle(1).
  15.  
  16.     The formatting can be controlled with input parameters as described in
  17.     the the section on "OPTIONS" section.
  18.  
  19.     The the section on "EXAMPLES" section may contain enough information to
  20.     get you started. New users may benefit from the short tutorial which
  21.     comes with the distribution.
  22.  
  23. EXAMPLES
  24.     These examples illustrate some of the most common parameters.
  25.  
  26.       perltidy somefile.pl
  27.  
  28.     This will produce a file somefile.pl.tdy containing the script
  29.     reformatted using the default options.
  30.  
  31.       perltidy *.pl
  32.  
  33.     Execute perltidy on all .pl files in the current directory with the
  34.     default options. The output will be in files with an appended .tdy
  35.     extension. For any file with an error, there will be files with
  36.     extensions .ERR and .LOG.
  37.  
  38.       perltidy -i=3 somefile.pl
  39.  
  40.     Execute perltidy on file somefile.pl, with 3 columns for each level of
  41.     indentation (instead of the default 4 columns). There will not be any
  42.     tabs in the reformatted script, except for any which already exist in
  43.     comments, pod documents, quotes, and here documents. Output will be
  44.     somefile.pl.tdy.
  45.  
  46.       perltidy -i=3 -t somefile.pl
  47.  
  48.     Same as the previous example, except that each set of 3 columns of
  49.     indentation will be represented by one leading tab character.
  50.  
  51.       perltidy -ce -l=72 somefile.pl
  52.  
  53.     Execute perltidy on file somefile.pl with all defaults except use
  54.     "cuddled elses" and a maximum line length of 72 columns (instead of the
  55.     default 80 columns).
  56.  
  57.       perltidy -io somefile.pl
  58.  
  59.     Execute perltidy on file somefile.pl but restrict changes to
  60.     "indentation only", which means that existing line breaks and whitespace
  61.     will be unchanged.
  62.  
  63.       perltidy -g somefile.pl
  64.  
  65.     Execute perltidy on file somefile.pl and save a log file somefile.pl.LOG
  66.     which shows the nesting of braces, parentheses, and square brackets at
  67.     the start of every line.
  68.  
  69. OPTIONS
  70.     The entire command line is scanned for options, and they are processed
  71.     them before any files are processed. As a result, it does not matter
  72.     whether flags are before or after any filenames. However, the relative
  73.     order of parameters is important, with later parameters overriding the
  74.     values of earlier parameters.
  75.  
  76.     For each parameter, there is a long name and a short name. The short
  77.     names are convenient for keyboard input, while the long names are
  78.     self-documenting and therefore useful in scripts. It is customary to use
  79.     two leading dashes for long names, but one may be used.
  80.  
  81.     Most parameters which serve as on/off flags can be negated with a
  82.     leading "n" (for the short name) or a leading "no" (for the long name).
  83.     For example, the flag to use tabs is -t or --tabs. The flag to use no
  84.     tabs (the default) is -nt or --notabs.
  85.  
  86.     Options may not be bundled together.
  87.  
  88.   I/O control
  89.  
  90.     -h, --help
  91.         Show summary of usage and exit.
  92.  
  93.     -o=filename, --outfile=filename
  94.         Name of the output file (only if a single input file is being
  95.         processed). If no output file is specified, and output is not
  96.         redirected to the standard output, the output will go to
  97.         filename.tdy.
  98.  
  99.     -st, --standard-output
  100.         Sends the output script to the standard output. For example,
  101.  
  102.           perltidy somefile.pl -st >somefile.new.pl
  103.  
  104.         This option may only be used if there is a single input file.
  105.  
  106.     -q, --quiet
  107.         Deactivate error messages and syntax checking (for running under an
  108.         editor).
  109.  
  110.         For example, if you use a vi-style editor, such as vim, you may
  111.         execute perltidy as a filter from within the editor using something
  112.         like
  113.  
  114.          :n1,n2!perltidy -q
  115.  
  116.         where `n1,n2' represents the selected text. Without the -q flag, any
  117.         error messages will mess up your screen. Besides, it is common to
  118.         run perltidy on incomplete blocks from an editor, and you don't want
  119.         to see any complaints about that. (Or maybe you do; in that case, be
  120.         prepared to use your "undo" key).
  121.  
  122.     -syn, --check-syntax
  123.         This causes perltidy to run `perl -c' to check syntax of input and
  124.         output. This is the default and highly recommended. The results are
  125.         written to the .LOG file, which will be saved if an error is
  126.         detected in the output script. The output script is not checked if
  127.         the input script has a syntax error. To skip syntax checking, use
  128.         -nsyn or --nocheck-syntax. Syntax checking is also deactivated by
  129.         the --quiet flag, discussed above.
  130.  
  131.     -log, --logfile
  132.         Save the .LOG file, which has many useful diagnostics. Perltidy
  133.         always creates a .LOG file, but by default it is deleted if there
  134.         are no errors. Setting the -log flag forces the log file to be
  135.         saved.
  136.  
  137.     -g=n, --logfile-gap=n
  138.         Set maximum interval between input code lines in the logfile. This
  139.         purpose of this flag is to assist in debugging nesting errors. The
  140.         value of `n' is optional. If you set the flag -g without the value
  141.         of `n', it will be taken to be 1, meaning that every line will be
  142.         written to the log file. This can be helpful if you are looking for
  143.         a brace, paren, or bracket nesting error.
  144.  
  145.         Setting -g also causes the logfile to be saved, so it is not
  146.         necessary to also include -log.
  147.  
  148.         If no -g flag is given, a value of 50 will be used, meaning that at
  149.         least every 50th line will be recorded in the logfile. This helps
  150.         prevent excessively long log files.
  151.  
  152.         Setting a negative value of `n' is the same as not setting -g at
  153.         all.
  154.  
  155.     -npro --noprofile
  156.         Ignore any .perltidyrc command file. Normally, perltidy looks first
  157.         in your current directory for a .perltidyrc file of parameters. (The
  158.         format is described below). If it finds one, it applies those
  159.         options to the initial default values, and then it applies any that
  160.         have been defined on the command line. If no .perltidyrc file is
  161.         found, it looks for one in your home directory.
  162.  
  163.         If you set the -npro flag, perltidy will not look for this file.
  164.  
  165.     -opt, --show-options
  166.         Write a list of all options used to the .LOG file. This is useful
  167.         for debugging command files. In the list, the status of on/off
  168.         switches is indicated by a 0 for off and a 1 for on.
  169.  
  170.     -f, --force-read-binary
  171.         Force perltidy to process binary files. Normally, perltidy skips
  172.         files identified by the system as non-text. This flag causes all
  173.         existing files to be processed.
  174.  
  175.   Basic Options
  176.  
  177.     -i=n, --indent-columns=n
  178.         Use n columns per indentation level (default n=4).
  179.  
  180.         See also --tabs.
  181.  
  182.     -t, --tabs
  183.         This flag defines the characters used to indicate the indentation
  184.         level of each line of code to be tabs. Perltidy allows two possible
  185.         ways to represent the indentation at the beginning of each line of
  186.         code. You may either use one tab character per level of indentation
  187.         (signified with the -t flag), or you may use n real space characters
  188.         per level, (where n is defined by the -i flag). The choice depends
  189.         upon which is most convenient for your editor or viewer. The default
  190.         is to use ASCII space characters because they should be properly
  191.         displayed on all editors or viewers, even though they are not always
  192.         the most convenient for editing. Of course, you can always rerun
  193.         perltidy to change the indentation characters.
  194.  
  195.         If you choose tabs, you will want to give the appropriate setting to
  196.         your editor to display tabs as 4 blanks (or whatever value has been
  197.         set with the -i command).
  198.  
  199.         Except for these possible tab indentation characters, Perltidy does
  200.         not introduce any tab characters into your file, and it removes any
  201.         tabs from the code (unless requested not to do so with -fws). If you
  202.         have any tabs in your comments, quotes, or here-documents, they will
  203.         remain.
  204.  
  205.     -nt, --notabs
  206.         Use space (blank) characters instead of tabs for leading
  207.         indentation. This is the default, following the recommendation in
  208.         perlstyle(1), although many programmers will prefer tabs.
  209.  
  210.     -io, --indent-only
  211.         This flag is used to deactivate all formatting and line break
  212.         changes. When it is in effect, the only change to the script will be
  213.         indentation. And any flags controlling whitespace and newlines will
  214.         be ignored. You might want to use this if you are perfectly happy
  215.         with your whitespace and line breaks, and merely want perltidy to
  216.         handle the indentation.
  217.  
  218.         Setting this flag is equivalent to setting --freeze-newlines and
  219.         --freeze-whitespace.
  220.  
  221.   Whitespace Control
  222.  
  223.     -fws, --freeze-whitespace
  224.         This flag causes your original whitespace to remain unchanged, and
  225.         causes the rest of the whitespace commands in this section to be
  226.         ignored.
  227.  
  228.     Tightness of curly braces, parentheses, and square brackets.
  229.         Here the term "tightness" will mean the closeness with which pairs
  230.         of enclosing tokens, such as parentheses, contain the quantities
  231.         within. A numerical value of 0, 1, or 2 defines the tightness, with
  232.         0 being least tight and 2 being most tight.
  233.  
  234.         The -pt=n or --paren-tightness parameter controls the space within
  235.         parens. The example below shows the effect of the three possible
  236.         values, 0, 1, and 2:
  237.  
  238.          if ( ( my $len_tab = length( $tabstr ) ) > 0 ) {  # -pt=0
  239.          if ( ( my $len_tab = length($tabstr) ) > 0 ) {    # -pt=1 (default)
  240.          if ((my $len_tab = length($tabstr)) > 0) {        # -pt=2
  241.  
  242.         When n is 0, there is always a space to the right of a '(' and to
  243.         the left of a ')'. For n=2 there is never a space. For n=1, the
  244.         default, there is a space unless the quantity within the parens is a
  245.         single token, such as an identifier or quoted string.
  246.  
  247.         Likewise, the parameter -bt=n or --brace-tightness=n controls the
  248.         space within curly braces, as illustrated in the example below.
  249.  
  250.          if ( $Opts{ help } ) { usage(); exit 1; }    # -bt=0
  251.          if ( $Opts{help} ) { usage(); exit 1; }      # -bt=1 (default)
  252.          if ( $Opts{help} ) {usage(); exit 1;}        # -bt=2
  253.  
  254.         And finally, the parameter -sbt=n or --square-bracket-tightness
  255.         controls the space within square brackets, as illustrated below.
  256.  
  257.          $width = $col[ $j + $k ] - $col[ $j ];  # -sbt=0
  258.          $width = $col[ $j + $k ] - $col[$j];    # -sbt=1 (default)
  259.          $width = $col[$j + $k] - $col[$j];      # -sbt=2 
  260.  
  261.     -ci=n, --continuation-indentation=n
  262.         Continuation indentation is extra indentation spaces applied when a
  263.         long line is broken. The default is n=2, illustrated here:
  264.  
  265.          my $level =   # -ci=2      
  266.            ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
  267.  
  268.         The same example, with n=0, is a little harder to read:
  269.  
  270.          my $level =   # -ci=0    
  271.          ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
  272.  
  273.     -ibc, --indent-block-comments
  274.         Block comments, meaning full-line comments, normally look best when
  275.         they are indented to the same level as the code which follows them.
  276.         This is the default behavior, but you may use -nibc to keep block
  277.         comments left-justified. Here is an example:
  278.  
  279.                      # this comment is indented      (-ibc, default)
  280.                      if ($task) { yyy(); }
  281.  
  282.     -nibc, --noindent-block-comments
  283.         Do not indent block comments. Here is an example:
  284.  
  285.          # this comment is not indented              (-nibc)
  286.                      if ($task) { yyy(); }
  287.  
  288.     -oll, --outdent-long-lines
  289.         When -oll is set, lines which cannot be broken into pieces less than
  290.         the maximum-line-length will have their indentation removed to make
  291.         them more readable. This is the default. This can mainly occur for
  292.         long quoted strings and long comments. To prevent such out-denting,
  293.         use -noll or --nooutdent-long-lines.
  294.  
  295.     -msc=n, minimum-space-to-comment=n
  296.         Side comments look best when lined up several spaces to the right of
  297.         code. Perltidy will try to keep comments at least n spaces to the
  298.         right. The default is n=4 spaces.
  299.  
  300.     -sts, --space-terminal-semicolon
  301.         Some programmers prefer a space before all terminal semicolons. The
  302.         default is for no such space, and is indicated with -nsts or
  303.         --nospace-terminal-semicolon.
  304.  
  305.                 $i = 1 ;     #  -sts
  306.                 $i = 1;      #  -nsts   (default)
  307.  
  308.     -sfs, --space-for-semicolon
  309.         Semicolons within for loops may sometimes be hard to see,
  310.         particularly when commas are also present. This option places spaces
  311.         on both sides of these special semicolons, and is the default. Use
  312.         -nsfs or --nospace-for-semicolon to deactivate it.
  313.  
  314.          for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) {  # -sfs (default)
  315.          for ( @a = @$ap, $u = shift @a; @a; $u = $v ) {    # -nsfs
  316.  
  317.     -asc, --add-semicolons
  318.         Setting -asc allows perltidy to add any missing optional semicolon
  319.         at the end of a line which is followed by a closing curly brace on
  320.         the next line. This is the default, and may be deactivated with
  321.         -nasc or --noadd-semicolons.
  322.  
  323.     -dsc, --delete-semicolons
  324.         Setting -dsc allows perltidy to delete extra semicolons which are
  325.         simply empty statements. This is the default, and may be deactivated
  326.         with -ndsc or --nodelete-semicolons. (Such semicolons are not
  327.         deleted, however, if they would promote a side comment to a block
  328.         comment).
  329.  
  330.     -aws, --add-whitespace
  331.         Setting this option allows perltidy to add certain whitespace
  332.         improve code readability. This is the default. If you do not want
  333.         any whitespace added, but are willing to have some whitespace
  334.         deleted, use -naws. (Use -fws to leave whitespace completely
  335.         unchanged).
  336.  
  337.     -dws, --delete-old-whitespace
  338.         Setting this option allows perltidy to remove some old whitespace
  339.         between characters, if necessary. This is the default. If you do not
  340.         want any old whitespace removed, use -ndws or
  341.         --nodelete-old-whitespace.
  342.  
  343.   Line Break Control
  344.  
  345.     -fnl, --freeze-newlines
  346.         If you do not want any changes to the line breaks in your script,
  347.         set -fnl, and they will remain fixed, and the rest of the commands
  348.         in this section will be ignored.
  349.  
  350.     -l=n, --maximum-line-length=n
  351.         The default maximum line length is n=80 characters. Perltidy will
  352.         try to find line break points to keep lines below this length.
  353.         However, long quotes and side comments may cause lines to exceed
  354.         this length.
  355.  
  356.     -bbc, --blanks-before-comments
  357.         A blank line will be introduced before a full-line comment. This is
  358.         the default. Use -nbbc or --noblanks-before-comments to prevent such
  359.         blank lines from being introduced.
  360.  
  361.     -bbs, --blanks-before-subs
  362.         A blank line will be introduced before a sub definition. This is the
  363.         default. This is negated with -nbbs or --noblanks-before-subs.
  364.  
  365.     -bbb, --blanks-before-blocks
  366.         A blank line may be introduced before blocks of coding delimited by
  367.         for, foreach, while, until, and if. This is the default. This is
  368.         negated with -nbbb or --noblanks-before-blocks.
  369.  
  370.     -mbl=n --maximum-consecutive-blank-lines=n
  371.         This parameter specifies the maximum number of consecutive blank
  372.         lines in the output script. The default is n=1. If the input file
  373.         has more than n consecutive blank lines, the number will be reduced
  374.         to n.
  375.  
  376.     -sob, --swallow-optional-blank-lines
  377.         Blank lines governed by the above flags, -bbb, -bbs, and -bbc, will
  378.         be deleted. (But essential blank lines above pod documents will be
  379.         retained). This is NOT the default.
  380.  
  381.     -nsob, --noswallow-optional-blank-lines
  382.         Retain blank lines, including those which do not corresponding to
  383.         flags -bbb, -bbs, and -bbc. This is the default. The number of
  384.         blanks retained is subject to the limit imposed by
  385.         --maximum-consecutive-blank-lines, however.
  386.  
  387.     -ce, --cuddled-else
  388.         Enable the "cuddled else" style, in which `else' and `elsif' are
  389.         follow immediately after the curly brace closing the previous block.
  390.         The default is not to use cuddled elses, and is indicated with the
  391.         flag -nce or --nocuddled-else. Here is a comparison of the
  392.         alternatives:
  393.  
  394.           if ($task) {
  395.               yyy();
  396.           } else {    # -ce
  397.               zzz();
  398.           }
  399.  
  400.           if ($task) {
  401.                 yyy();
  402.           }
  403.           else {    # -nce  (default)
  404.                 zzz();
  405.           }
  406.  
  407.     -bl, --opening-brace-on-new-line
  408.         Use the flag -bl to place the opening brace on a new line:
  409.  
  410.           if ( $input_file eq '-' ) 
  411.           {                             # -bl
  412.  
  413.         This flag applies to all structural blocks, including sub's.
  414.  
  415.         The default style, -nbl, places an opening brace on the same line as
  416.         the keyword introducing it. For example,
  417.  
  418.           if ( $input_file eq '-' ) {   # -nbl (default)
  419.  
  420.     -dnl, --delete-old-newlines
  421.         By default, perltidy first deletes all old line break locations, and
  422.         then it looks for optimal break points to match the desired line
  423.         length. Use -ndnl or --nodelete-old-newlines to force perltidy to
  424.         retain all old line break points.
  425.  
  426.     -anl, --add-newlines
  427.         By default, perltidy will add line breaks when necessary to create
  428.         continuations of long lines and to improve the script appearance.
  429.         Use -nanl or -noadd-newlines to prevent any new line breaks.
  430.  
  431.         This flag does not prevent perltidy from eliminating existing line
  432.         breaks; see -freeze-newlines to completely prevent changes to line
  433.         break points.
  434.  
  435.   Other Controls
  436.  
  437.     Writing selected text to a file
  438.         When perltidy writes a formatted text file, it has the ability to
  439.         also send selected text to a file with a .TEE extension. This text
  440.         can include comments and pod documentation. The relevant commands
  441.         are: -tac or --tee-all-comments, -tbc or --tee-block-comments, -tsc
  442.         or --tee-side-comments, and -tp or --tee-pod. The negatives of these
  443.         commands also work, and are the defaults.
  444.  
  445.     Deleting selected text
  446.         Perltidy can selectively delete comments and pod documentation. The
  447.         commands to do this are:
  448.  
  449.         -dac or --delete-all-comments, -dbc or --delete-block-comments, -dsc
  450.         or --delete-side-comments, and -dp or --delete-pod. The negatives of
  451.         these commands also work, and are the defaults.
  452.  
  453.     Using a .perltidyrc command file
  454.         Perltidy will first look in your current directory for a command
  455.         file named .perltidyrc, and if it does not find one, it will look in
  456.         your home directory. This file is free format, and simply a list of
  457.         parameters, just as they would be entered on a command line. Any
  458.         number of lines may be used, with any number of parameters per line,
  459.         although it may be easiest to read with one parameter per line.
  460.         Blank lines are ignored, and text after a '#' is ignored to the end
  461.         of a line.
  462.  
  463.         Here is an example of a .perltidyrc file:
  464.  
  465.           # This is a simple of a .perltidyrc configuration file
  466.           # This implements a highly spaced style
  467.           -bl    # braces on new lines
  468.           -pt=0  # parens not tight at all
  469.           -bt=0  # braces not tight
  470.           -sbt=0 # square brackets not tight
  471.  
  472.         The parameters in the .perltidyrc file are installed first, so any
  473.         parameters given on the command line will have priority over them.
  474.         The parameters in the .perltidyrc file can be completely ignored
  475.         with the -npro option.
  476.  
  477.     Creating a new abbreviation
  478.         A special notation is available for use in a .perltidyrc file for
  479.         creating an abbreviation for a group of options. This can be used to
  480.         create a shorthand for one or more styles which are frequently, but
  481.         not always, used. The notation is to group the options within curly
  482.         braces which are preceded by the name of the alias (without leading
  483.         dashes), like this:
  484.  
  485.                 newword {
  486.                 -opt1
  487.                 -opt2
  488.                 }
  489.  
  490.         where newword is the abbreviation, and opt1, etc, are existing
  491.         parameters *or other abbreviations*. The main syntax requirement is
  492.         that the new abbreviation must begin on a new line. Space before and
  493.         after the curly braces is optional. For a specific example, the
  494.         following line
  495.  
  496.                 airy {-bl -pt=0 -bt=0 -sbt=0}
  497.  
  498.         could be placed in a .perltidyrc file, and then invoked at will with
  499.  
  500.                 perltidy -airy somefile.pl
  501.  
  502.         (Either `-airy' or `--airy' may be used).
  503.  
  504.     -sil=n --starting-indentation-level=n
  505.         By default, perltidy examines the input file and tries to determine
  506.         the starting indentation level. While it is often zero, it may not
  507.         be zero for a code snippet being sent from an editing session. If
  508.         the default method does not work correctly, or you want to change
  509.         the starting level, use -sil=n, to force the starting level to be n.
  510.  
  511.     Controlling list formatting and vertical alignment
  512.         Perltidy attempts to place comma-separated arrays of values in
  513.         tables which can be vertically aligned. The number of fields is, by
  514.         default, chosen to be the largest even number which fits in the
  515.         current page width (defined by -l=n). Usually this works well.
  516.  
  517.         There are two ways to control this formatting. The first is with the
  518.         use of comments or empty lines. If there are any comments or blank
  519.         lines between the opening and closing structural brace, parenthesis,
  520.         or bracket containing the list, then the original line breaks will
  521.         be used for the entire list instead.
  522.  
  523.         The second is with the parameter --mft=n or
  524.         --maximum-fields-per-table=n. The default value for n is a large
  525.         number, 40. If the computed number of fields for any table exceeds
  526.         n, then it will be reduced to n. While this value should probably be
  527.         left unchanged as a general rule, it might be used on a small
  528.         section of code to force a list to have a particular number of
  529.         fields per line, and then a single comment could be introduced
  530.         somewhere to freeze the formatting in future applications of
  531.         perltidy.
  532.  
  533.         Vertical alignment refers to lining up similar tokens vertically,
  534.         like this:
  535.  
  536.          my $lines     = 0;    # checksum: #lines
  537.          my $bytes     = 0;    # checksum: #bytes
  538.          my $sum       = 0;    # checksum: system V sum
  539.  
  540.         Once the perltidy vertical aligner "locks on" to a pattern, such as
  541.         defined by the "=" and "#" in the above example, it retains the
  542.         pattern for as long as possible. However, a blank line or full-line
  543.         comment will cause it to forget the pattern and start looking for
  544.         another. Thus, a single blank line can be introduced to force the
  545.         aligner to stop aligning when it is undesirable.
  546.  
  547.     Making a file unreadable
  548.         The goal of perltidy is to improve the readability of files, but
  549.         there are two commands which have the opposite effect, --mangle and
  550.         --extrude. They are actually merely aliases for combinations of
  551.         other parameters. Both of these strip all possible whitespace, but
  552.         leave comments and pod documents, so that they are essentially
  553.         reversible. The difference between these is that --mangle puts the
  554.         fewest possible line breaks in a script while --extrude puts the
  555.         maximum possible. Note that these options do not provided any
  556.         meaningful obfuscation, because perltidy can be used to reformat the
  557.         files. A useful application of --mangle is the following:
  558.  
  559.           perltidy -mangle myfile.pl -st | perltidy -o myfile.pl.new
  560.  
  561.         This is a simple way to clean up a badly formatted script.
  562.  
  563.     One-line blocks
  564.         There are a few points to note regarding one-line blocks. A one-line
  565.         block is something like this,
  566.  
  567.                 if ($x > 0) { $y = 1 / $x }  
  568.  
  569.         where the contents within the curly braces is short enough to fit on
  570.         a single line.
  571.  
  572.         With few exceptions, Perltidy retains existing one-line blocks, if
  573.         it is possible within the line-length constraint, but it does not
  574.         attempt to form new ones. In other words, Perltidy will try to
  575.         follow the one-line block style of the input file.
  576.  
  577.         If an existing one-line block is longer than the maximum line
  578.         length, however, it will be broken into multiple lines. When this
  579.         happens, perltidy checks for and adds any optional terminating
  580.         semicolon (unless the -nasc option is used) if the block is a code
  581.         block.
  582.  
  583.         The main exception is that Perltidy will attempt to form new
  584.         one-line blocks following the keywords `map', `eval', and `sort',
  585.         because these code blocks are often small and most clearly displayed
  586.         in a single line.
  587.  
  588.         Occasionally it is helpful to introduce line breaks in lists
  589.         containing a '=>' symbol, which is sometimes called a "comma-arrow".
  590.         To force perltidy to introduce breaks in a one-line block containing
  591.         comma arrows, use the --break-after-comma-arrows, or -baa, flag. For
  592.         example, given the following single line, Perltidy will not add any
  593.         line breaks:
  594.  
  595.             bless { B => $B, Root => $Root } => $package;   -nbaa (default)
  596.  
  597.         To introduce breaks to show the structure, use -baa:
  598.  
  599.             bless {                                         -baa
  600.                 B    => $B,
  601.                 Root => $Root
  602.             } => $package;
  603.  
  604.         One-line block rules can conflict with the cuddled-else option. When
  605.         the cuddled-else option is used, perltidy retains existing one-line
  606.         blocks, even if they do not obey cuddled-else formatting.
  607.  
  608.     Writing an HTML file
  609.         The flag -html causes perltidy to write an html file with extension
  610.         .html. So, for example, the following command
  611.  
  612.                 perltidy -html somefile.pl
  613.  
  614.         will produce a syntax-colored html file named somefile.pl.html which
  615.         may be viewed with a browser.
  616.  
  617.         Please Note: In this case, perltidy does not do any formatting to
  618.         the input file other than indenting it, and it does not write a a
  619.         formatted file with extension .tdy. This means that, for now, two
  620.         perltidy runs are required to create a fully reformatted, html copy
  621.         of a script. (This behavior may change in the future).
  622.  
  623.         A default set of colors has been defined, but they may be changed by
  624.         providing values to any of the following parameters, where n is a 6
  625.         digit hex RGB color value:
  626.  
  627.                 -html-color-xxxxxx=n or -hcx=n
  628.  
  629.                 where xxxxxx is one of the following words, and x is the
  630.                 corresponding abbreviation:
  631.  
  632.                       Token Type             xxxxxx           x 
  633.                       ----------             --------         --
  634.                       number                 numeric          n
  635.                       identifier             identifier       i
  636.                       bareword, function     bareword         w
  637.                       keyword                keyword          k
  638.                       quite, pattern         quote            q
  639.                       here doc text          here-doc-text    h
  640.                       here doc target        here-doc-target  H
  641.                       punctuation            punctuation      pu
  642.                       parentheses            paren            p
  643.                       structural braces      structural       s
  644.                       semicolon              semicolon        sc
  645.                       colon                  colon            co
  646.                       comma                  comma            cm
  647.                       label                  label            J
  648.  
  649.                 To illustrate, the following command will produce an html
  650.                 file somefile.pl.html with magenta keywords:
  651.  
  652.                         perltidy -html -hck=ff00ff somefile.pl
  653.  
  654.                 Two other character attributes may be set: bold, and
  655.                 italics. To set a token type to use bold, use the flag
  656.                 -html-bold-xxxxxx or -hbx, where xxxxxx or x are the long or
  657.                 short names from the above table.
  658.  
  659.                 Likewise, to set a token type to use an italic font, use the
  660.                 flag -html-italic-xxxxxx or -hix, where again xxxxxx or x
  661.                 are the long or short names from the above table. For
  662.                 example, to use bold braces and green, bold, italics
  663.                 keywords the following command would be used:
  664.  
  665.                         perltidy -html -hbs -hck=00FF00 -hik -hbk somefile.pl
  666.  
  667.                 The background color can be specified with
  668.                 -html-color-background=n, or -hcbg=n for short, where n is a
  669.                 6 character hex RGB value. The default color of text is the
  670.                 value given to punctuation, which is black as a default.
  671.  
  672. LIMITATIONS
  673.         Parsing Limitations
  674.             Perltidy should work properly on most Perl scripts. It does a
  675.             lot of self-checking, but still, it is possible that an error
  676.             could be introduced and go undetected. Therefore, it is
  677.             essential to make careful backups and to test reformatted
  678.             scripts.
  679.  
  680.             The main current limitation is that perltidy does not scan
  681.             modules included with 'use' statements. This makes it necessary
  682.             to guess the context of any bare words introduced by such
  683.             modules. Perltidy has good guessing algorithms, but they are not
  684.             infallible. When it must guess, it leaves a message in the log
  685.             file.
  686.  
  687.             If you encounter a bug, please report it.
  688.  
  689.         What perltidy does not format
  690.             Perltidy indents but does not reformat comments and `qw' quotes.
  691.             Perltidy does not in any way modify the contents of here
  692.             documents or quoted text, even if they contain source code. (You
  693.             could, however, reformat them separately). And, of course, it
  694.             does not modify pod documents.
  695.  
  696. FILES
  697.         Special files when standard input or standard output are used
  698.             When standard input is used, the log file, if saved, is
  699.             perltidy.LOG, and any error file is perltidy.ERR. These are
  700.             saved in the current working directory. If syntax checking is
  701.             used, a temporary copy of the input file will be created in the
  702.             current working directory called perltidy.TMPI, but it will be
  703.             removed when perltidy finishes.
  704.  
  705.             When standard output and syntax checking are used, a temporary
  706.             copy of the output file will be created in the current working
  707.             directory called perltidy.TMPO. It will be removed when perltidy
  708.             finishes.
  709.  
  710.         Files overwritten
  711.             The following file extensions are used by perltidy, and files
  712.             with these extensions may be overwritten or deleted: .tdy, .ERR,
  713.             .LOG, .TEE, .TMPI, .TMPO.
  714.  
  715.         Files extensions limitations
  716.             Perltidy does not operate on files for which the run could
  717.             produce a file with a duplicated file extension. These
  718.             extensions are .tdy, .LOG, .ERR, .TEE, .TMPI, .TMPO. The purpose
  719.             of this rule is to prevent generating confusing filenames such
  720.             as somefile.tdy.tdy.tdy.
  721.  
  722. SEE ALSO
  723.         perlstyle(1)
  724.  
  725. VERSION
  726.         This man page documents perltidy version 20010303.
  727.  
  728. AUTHOR
  729.           Steven L. Hancock
  730.           email: perltidy at users.sourceforge.net
  731.           http://perltidy.sourceforge.net
  732.  
  733. COPYRIGHT
  734.         Copyright (c) 2000, 2001 by Steven L. Hancock
  735.  
  736. LICENSE
  737.         This package is free software; you can redistribute it and/or modify
  738.         it under the terms of the "GNU General Public License".
  739.  
  740.         Please refer to the file "COPYING" for details.
  741.  
  742. DISCLAIMER
  743.         This package is distributed in the hope that it will be useful, but
  744.         WITHOUT ANY WARRANTY; without even the implied warranty of
  745.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  746.  
  747.         See the "GNU General Public License" for more details.
  748.  
  749.